import Vue from 'vue'
import UserDialog from './view/user'
import AuthDialog from './view/auth'
import ConditionDialog from './view/condition'
import FormDialog from './view/form'
import ExpressionDialog from './view/expression'

const UserDialogConstructor = Vue.extend(UserDialog)
const AuthDialogConstructor = Vue.extend(AuthDialog)
const ConditionDialogConstructor = Vue.extend(ConditionDialog)
const FormDialogConstructor = Vue.extend(FormDialog)
const ExpressionDialogConstructor = Vue.extend(ExpressionDialog)

export const UserProgressDialog = (options, methods = {}) => {
  const instance = new UserDialogConstructor({
    data: options,
    methods
  }).$mount();

  document.body.appendChild(instance.$el)
}

export const AuthProgressDialog = (options, methods = {}) => {
  const instance = new AuthDialogConstructor({
    data: options,
    methods
  }).$mount();

  document.body.appendChild(instance.$el)
}

export const ConditionProgressDialog = (options, methods = {}) => {
  const instance = new ConditionDialogConstructor({
    data: options,
    methods
  }).$mount();

  document.body.appendChild(instance.$el)
}

export const FormProgressDialog = (options, methods = {}) => {
  const instance = new FormDialogConstructor({
    data: options,
    methods
  }).$mount();

  document.body.appendChild(instance.$el)
}

export const ExpressionProgressDialog = (options, methods = {}) => {
  const instance = new ExpressionDialogConstructor({
    data: options,
    methods
  }).$mount();

  document.body.appendChild(instance.$el)
}
